﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.Model;
using Automobile.service.BLL;

namespace Automobile.service.UI
{
    public partial class AddStock : System.Web.UI.Page
    {
        StockBll bll = new StockBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            StockModel s = new StockModel();

            s.Stock_num =Convert.ToInt32(this.TextBox1.Text);
            s.Stock_warn= Convert.ToInt32(this.TextBox2.Text);
            s.WareHose_Id=Convert.ToInt32( this.TextBox3.Text);
            s.Product_Id=Convert.ToInt32( this.TextBox4.Text);
            if (bll.AddStock(s) > 0)
            {
                Response.Write("<script>alert('添加成功!');location.href='Stock.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');</script>");
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("Stock.aspx");
        }
    }
}